package com.youdianstar.app.common.ex

import android.content.Intent
import com.google.gson.Gson


/**
 * File: IntentEx
 * Author: 82149 Create: 2021/11/26 18:47
 * Changes (from 2021/11/26)
 * --------------------------------------------------
 * description:
 * ---------------------------------------------------
 *
 */

inline fun <reified T : Any> Intent.getObject(key: String):T?{
    return getStringExtra(key)?.let {
        Gson().fromJson(it, T::class.java)
    }
}

fun Any.toJson():String{
    return Gson().toJson(this)
}

